<?php
$inAdmin    = gpc_getStringPost('admin',gpc_getStringGet('admin'));

if($inAdmin == 'admin')
{
    $file   = 'language/'.$language.'.dat';
}
else
{
    $file   = '../language/'.$language.'.dat';
}

/////////////////////////////////////

$alllang    = readLangFile($file);

if($actPost=='save')
{
    $langs    = gpc_getStringArray('lang');
    foreach($alllang as $name=>$vl)
    {
        if(!empty($langs[$name]) && !empty($langs[$name]))
        {            
            $alllang[$name] = $langs[$name];
        }
        else if(empty($langs[$name]))
        {
            unset($alllang[$name]);
        }
    }
    writeLangFile($alllang,$file);
    
    
    Insert_Tracking("Change language in lang: ".$language);
    page_transfer("Save Language Success",$pagetr);
    exit;
}

?>